package com.pg.free.actor.menu;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.pg.free.util.Const;
import com.pg.free.util.Logger;

public class Exit extends Actor {

	private Texture exit;

	public Exit() {

		exit = new Texture(Gdx.files.internal("image/exit.png"));
		this.setWidth(exit.getWidth());
		this.setHeight(exit.getHeight());
		this.setX(Const.viewWidth / 2 - this.getWidth() / 2);
		this.setY(Const.viewHeight / 2 - this.getHeight() * 2);

		this.addListener(new InputListener() {

			@Override
			public boolean touchDown(InputEvent event, float x, float y,
					int pointer, int button) {

				return true;
			}
		});
	}

	@Override
	public void draw(SpriteBatch batch, float parentAlpha) {
		batch.draw(exit, getX(), getY());
	}
	
	public void dispose(){
		exit.dispose();
		Logger.debug("exit", "dispose");
	}
}
